package cn.csc.module.member.api.address;

import cn.csc.framework.common.pojo.CommonResult;
import cn.csc.module.member.api.address.dto.MemberAddressRespDTO;
import cn.csc.module.member.enums.ApiConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 用户收件地址 API 接口
 *
 * @author liuchuang
 */
@FeignClient(name = ApiConstants.NAME) // TODO fallbackFactory =
@Api(tags = "RPC 服务 - 用户地址")
public interface MemberAddressApi {

    String PREFIX = ApiConstants.PREFIX + "/address";

    @GetMapping(PREFIX + "/get")
    @ApiOperation("获得用户收件地址")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "收件地址编号", required = true, example = "1024"),
            @ApiImplicitParam(name = "userId", value = "用户编号", required = true, example = "2048"),
    })
    CommonResult<MemberAddressRespDTO> getAddress(@RequestParam("id") Long id,
                                                  @RequestParam("userId") Long userId);

    @GetMapping(PREFIX + "/get-default")
    @ApiOperation("获得用户默认收件地址")
    @ApiImplicitParam(name = "userId", value = "用户编号", required = true, example = "2048")
    CommonResult<MemberAddressRespDTO> getDefaultAddress(@RequestParam("userId") Long userId);


}
